﻿// Decompiled with JetBrains decompiler
// Type: UnityEngine.Rendering.BatchCullingContext
// Assembly: UnityEngine.CoreModule, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null
// MVID: E6AE6B5A-2752-4B07-9528-C8B77C62CE79
// Assembly location: C:\Users\windys\Unity\2021.3.39f1c1\Editor\Data\Managed\UnityEngine\UnityEngine.CoreModule.dll
// XML documentation location: C:\Users\windys\Unity\2021.3.39f1c1\Editor\Data\Managed\UnityEngine\UnityEngine.CoreModule.xml

using System;
using Unity.Collections;
using Unity.Collections.LowLevel.Unsafe;
using UnityEngine.Bindings;
using UnityEngine.Scripting;

#nullable disable
namespace UnityEngine.Rendering
{
  /// <summary>
  ///   <para>Culling context for a batch.</para>
  /// </summary>
  [UsedByNativeCode]
  [NativeHeader("Runtime/Camera/BatchRendererGroup.h")]
  public struct BatchCullingContext
  {
    /// <summary>
    ///   <para>Planes to cull against.</para>
    /// </summary>
    public readonly NativeArray<Plane> cullingPlanes;
    /// <summary>
    ///   <para>Visibility information for the batch.</para>
    /// </summary>
    public NativeArray<BatchVisibility> batchVisibility;
    /// <summary>
    ///   <para>Array of visible indices for all the batches in the group.</para>
    /// </summary>
    public NativeArray<int> visibleIndices;
    /// <summary>
    ///   <para>Array of uints containing extra data for the visible indices for all the batches in the group. Elements in this array correspond to elements in Rendering.BatchCullingContext.visibleIndices.</para>
    /// </summary>
    public NativeArray<int> visibleIndicesY;
    /// <summary>
    ///   <para>Additional resources: LODParameters.</para>
    /// </summary>
    public readonly LODParameters lodParameters;
    /// <summary>
    ///   <para>Culling matrix.</para>
    /// </summary>
    public readonly Matrix4x4 cullingMatrix;
    /// <summary>
    ///   <para>The near frustum plane for this culling context.</para>
    /// </summary>
    public readonly float nearPlane;

    [Obsolete("For internal BatchRendererGroup use only")]
    public unsafe BatchCullingContext(
      NativeArray<Plane> inCullingPlanes,
      NativeArray<BatchVisibility> inOutBatchVisibility,
      NativeArray<int> outVisibleIndices,
      LODParameters inLodParameters)
    {
      this.cullingPlanes = inCullingPlanes;
      this.batchVisibility = inOutBatchVisibility;
      this.visibleIndices = outVisibleIndices;
      this.visibleIndicesY = NativeArrayUnsafeUtility.ConvertExistingDataToNativeArray<int>((void*) null, 0, Allocator.Invalid);
      this.lodParameters = inLodParameters;
      this.cullingMatrix = Matrix4x4.identity;
      this.nearPlane = 0.0f;
    }

    [Obsolete("For internal BatchRendererGroup use only")]
    public unsafe BatchCullingContext(
      NativeArray<Plane> inCullingPlanes,
      NativeArray<BatchVisibility> inOutBatchVisibility,
      NativeArray<int> outVisibleIndices,
      LODParameters inLodParameters,
      Matrix4x4 inCullingMatrix,
      float inNearPlane)
    {
      this.cullingPlanes = inCullingPlanes;
      this.batchVisibility = inOutBatchVisibility;
      this.visibleIndices = outVisibleIndices;
      this.visibleIndicesY = NativeArrayUnsafeUtility.ConvertExistingDataToNativeArray<int>((void*) null, 0, Allocator.Invalid);
      this.lodParameters = inLodParameters;
      this.cullingMatrix = inCullingMatrix;
      this.nearPlane = inNearPlane;
    }

    internal BatchCullingContext(
      NativeArray<Plane> inCullingPlanes,
      NativeArray<BatchVisibility> inOutBatchVisibility,
      NativeArray<int> outVisibleIndices,
      NativeArray<int> outVisibleIndicesY,
      LODParameters inLodParameters,
      Matrix4x4 inCullingMatrix,
      float inNearPlane)
    {
      this.cullingPlanes = inCullingPlanes;
      this.batchVisibility = inOutBatchVisibility;
      this.visibleIndices = outVisibleIndices;
      this.visibleIndicesY = outVisibleIndicesY;
      this.lodParameters = inLodParameters;
      this.cullingMatrix = inCullingMatrix;
      this.nearPlane = inNearPlane;
    }
  }
}
